home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Tk / unix / tkUnix.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-31  |  2.1 KB  |  80 lines

  1. /* 
  2.  * tkUnix.c --
  3.  *
  4.  *    This file contains procedures that are UNIX/X-specific, and
  5.  *    will probably have to be written differently for Windows or
  6.  *    Macintosh platforms.
  7.  *
  8.  * Copyright (c) 1995 Sun Microsystems, Inc.
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  *
  13.  * SCCS: @(#) tkUnix.c 1.3 96/02/15 18:55:18
  14.  */
  15.  
  16. #include <tkInt.h>
  17.  
  18. /*
  19.  *----------------------------------------------------------------------
  20.  *
  21.  * TkGetServerInfo --
  22.  *
  23.  *    Given a window, this procedure returns information about
  24.  *    the window server for that window.  This procedure provides
  25.  *    the guts of the "winfo server" command.
  26.  *
  27.  * Results:
  28.  *    None.
  29.  *
  30.  * Side effects:
  31.  *    None.
  32.  *
  33.  *----------------------------------------------------------------------
  34.  */
  35.  
  36. void
  37. TkGetServerInfo(interp, tkwin)
  38.     Tcl_Interp *interp;        /* The server information is returned in
  39.                  * this interpreter's result. */
  40.     Tk_Window tkwin;        /* Token for window;  this selects a
  41.                  * particular display and server. */
  42. {
  43.     char buffer[50], buffer2[50];
  44.  
  45.     sprintf(buffer, "X%dR%d ", ProtocolVersion(Tk_Display(tkwin)),
  46.         ProtocolRevision(Tk_Display(tkwin)));
  47.     sprintf(buffer2, " %d", VendorRelease(Tk_Display(tkwin)));
  48.     Tcl_AppendResult(interp, buffer, ServerVendor(Tk_Display(tkwin)),
  49.         buffer2, (char *) NULL);
  50. }
  51.  
  52. /*
  53.  *----------------------------------------------------------------------
  54.  *
  55.  * TkGetDefaultScreenName --
  56.  *
  57.  *    Returns the name of the screen that Tk should use during
  58.  *    initialization.
  59.  *
  60.  * Results:
  61.  *    Returns the argument or a string that should not be freed by
  62.  *    the caller.
  63.  *
  64.  * Side effects:
  65.  *    None.
  66.  *
  67.  *----------------------------------------------------------------------
  68.  */
  69.  
  70. char *
  71. TkGetDefaultScreenName(interp, screenName)
  72.     Tcl_Interp *interp;        /* Interp used to find environment variables. */
  73.     char *screenName;        /* Screen name from command line, or NULL. */
  74. {
  75.     if ((screenName == NULL) || (screenName[0] == '\0')) {
  76.     screenName = Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY);
  77.     }
  78.     return screenName;
  79. }
  80.